//    Openbravo POS is a point of sales application designed for touch screens.
//    Copyright (C) 2007-2009 Openbravo, S.L.
//    http://www.openbravo.com/product/pos
//
//    This file is part of Openbravo POS.
//
//    Openbravo POS is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Openbravo POS is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Openbravo POS.  If not, see <http://www.gnu.org/licenses/>.

package com.openbravo.pos.config;

import cn.ekuma.epos.module.CoreModel;
import cn.ekuma.rabbit.ModelManager;
import cn.ekuma.rabbit.spi.I_ModelPart;

import com.openbravo.pos.base.AppConfig;

import net.xeoh.plugins.base.PluginManager;

import java.util.ArrayList;

/**
 *
 * @author adrianromero
 */
public class JPanelConfiguration extends AbstractJPanelConfiguration implements I_ModelPart<CoreModel>{
        
 
	private PluginManager pmf;
	private ModelManager manager;
  
	public JPanelConfiguration() {
		super();
	}

	@Override
	public String getModelName() {
		return CoreModel.NAME;
	}

	@Override
	public void setModel(CoreModel mode) {
		this.manager=mode.getManager();
		 config = new AppConfig(manager.getConfigModel().getConfigFile());
	     pmf=manager.getPluginManager();
	     // Inicio lista de paneles
	        m_panelconfig = new ArrayList<PanelConfig>();
	        PanelConfig configPanel=new JPanelConfigDatabase();
	        configPanel.init(pmf);
	        m_panelconfig.add(configPanel);
	        configPanel=new JPanelConfigERP();
	        configPanel.init(pmf);
	        m_panelconfig.add(configPanel);
	        configPanel=new JPanelConfigGeneral();
	        configPanel.init(pmf);
	        m_panelconfig.add(configPanel);
	        configPanel=new JPanelConfigLocale();
	        configPanel.init(pmf);
	        m_panelconfig.add(configPanel);
	       
	        configPanel=new JPanelConfigPayment();
	        configPanel.init(pmf);
	        m_panelconfig.add(configPanel);
	        
	        // paneles auxiliares
	        for (PanelConfig c: m_panelconfig) {
	            m_jConfigOptions.add(c.getConfigComponent());
	        }
	}
}
